<?php
  include_once("../sql_connect.php");
  include_once("../msg_redirect.php");
?>
<?php

/*取得，取消关注者的u_no*/
$c_name = $_POST[name];

$my_sql = mysql_query("select u_no from user_info where u_name = '$c_name'");
$my_result = mysql_fetch_array($my_sql);

/*将被关注者的u_no赋值给$c_no，把自己的u_no赋值给$u_no*/
$c_no = $my_result[u_no];
$u_no = $_COOKIE['u_no'];

/*在concerns中查看是否该人已经被自己关注*/
$del_concerns = "";
$my_concnerns = mysql_query("select * from concerns where u_no = '$u_no' and c_no = '$c_no'");
$my_concnerns_result = mysql_fetch_array($my_concnerns);


$concerns_sql = mysql_query("select * from concerns where u_no = '$u_no' and c_no = '$c_no'");
$concerns_result = mysql_fetch_array($concerns_sql);
$no = $concerns_result[no] ;
$c_num = $concerns_result[c_num];
$f_num = $concerns_result[f_num];
    
    
	
/*u_no关注数减一*/
mysql_query("UPDATE concerns SET c_num =c_num -1 WHERE u_no='$u_no' AND c_num > '$c_num'");
	
/*c_no粉丝数减一*/
mysql_query("UPDATE concerns SET f_num =f_num -1 WHERE c_no='$c_no' AND f_num > '$f_num'");
		

/*删除数据*/
mysql_query("DELETE  FROM concerns WHERE u_no='$u_no' AND c_no='$c_no'  ");
	
/*no数据大于$no自动减一*/
mysql_query("UPDATE concerns SET no =no -1 WHERE no > '$no'");
	
return ;
?> 